#ifndef SHAPE_H
#define SHAPE_H//数据与逻辑兼具

#include "pubilc.h"
#include "cell.h"
#include "board.h"

class shape
{
public:
    shape(cell &, board& bd);//初始方格和棋盘
    virtual ~shape() = 0;
    virtual void rotate();//旋转
    int get_color() { return color; }//读取
    cell& get_a_cell(int n) { return cells[n]; }//读取
    void set_a_cell(int n, cell& _cell) { cells[n] = _cell; }//写入

protected:
    virtual void compute_rotate_positions();
    bool is_vaild_position(int);
    int color;//颜色
    cell cells[NUM_OF_CELLS];//四个方格
    QPoint rotate_positions[NUMBER_OF_ROTATE_POSITIONS][NUM_OF_CELLS];
    int which_position;//旋转相关
    board m_bd;
};

#endif // SHAPE_H
